<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>css动画原理</title>
  <script src="./vue.js"></script>
  <style>
    .fade-enter {
      opacity: 0;
    }
    .fade-enter-active {
      transition: 2s;
    }
    .fade-leave-to {
      opacity: 0;
    }
    .fade-leave-active {
      transition: 2s;
    }
  </style>
</head>
<body>
  <div id="root">
    <!-- transition标签包裹需要做动画的部分 -->
    <transition name="fade">
      <div v-show="show">hello world</div>
    </transition>
    <button @click="handleClick">点击显示隐藏</button>
  </div>

  <script>
    var vm = new Vue({
      el: '#root',
      data: {
        show: true
      },
      methods: {
        handleClick: function() {
          this.show = !this.show
        }
      }
    })

  </script>
</body>
</html>